package com.zr.sms.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.sms.model.Goods;
import com.zr.sms.service.Goodsinfomanageservice;
import com.zr.sms.serviceimpl.Goodsinfomanageserviceimpl;

public class ModifygoodsServlet extends HttpServlet{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	// TODO Auto-generated method stub
	doPost(req, resp);
}
@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		PrintWriter pw=resp.getWriter();
		int gid=Integer.parseInt(req.getParameter("gid"));
		Goods gs=new Goods();
		String gname=req.getParameter("gname");
		String ginventory=req.getParameter("ginventory");
		String gprice=req.getParameter("gprice");
		String gdate=req.getParameter("gdate");
		String gquality=req.getParameter("gquality");
		String gaddress=req.getParameter("gaddress");
		String gclassify=req.getParameter("gclassify");
		int ginventory1=Integer.parseInt(ginventory);
		double gprice1=Double.parseDouble(gprice);
		gs.setGid(gid);
		gs.setGname(gname);
		gs.setGinventory(ginventory1);
		gs.setGprice(gprice1);
		gs.setGdate(gdate);
		gs.setGquality(gquality);
		gs.setGaddress(gaddress);
		gs.setGclassify(gclassify);
		Goodsinfomanageservice gims=new Goodsinfomanageserviceimpl();
		boolean flag=gims.updategoods(gs);
		pw.write(String.valueOf(flag));
	}
}
